var url = 'http://localhost/server/json.php'

var xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
  if (xhr.readyState == 4 && xhr.status == 200) {
    console.log(JSON.parse(xhr.responseText))
  }

}
xhr.open('GET', url)
xhr.send(null)